
from selenium.webdriver.common.by import By


from Page.Login import Login


class adduser_Page(Login):
    #元素定位
    # 定位用户管理
    users_loc = (By.XPATH, '/html/body/div[1]/div[2]/div[2]/div[2]/div[5]/h2/span')
    # 用户信息
    mess_loc = (By.XPATH, '/html/body/div[1]/div[2]/div[2]/div[2]/div[6]/ul/li/div/a')
    # 添加用户
    add_loc = (By.XPATH, '/html/body/div[1]/div[3]/div/div[2]/div[2]/div[2]/div[1]/ul/li[1]/a/span')
    # 输入用户名称
    ming_loc = (By.XPATH, '/html/body/div[1]/div[3]/div/div[2]/div[3]/div/form/div[1]/div/fieldset/dl[1]/dd/input')
    # 输入手机号
    phone_loc = (By.XPATH, '/html/body/div[1]/div[3]/div/div[2]/div[3]/div/form/div[1]/div/fieldset/dl[2]/dd/input')
    # 输入登录密码
    denglu_loc = (By.XPATH, '/html/body/div[1]/div[3]/div/div[2]/div[3]/div/form/div[1]/div/fieldset/dl[3]/dd/input')
    # 提交按钮
    submit_loc = (By.XPATH, '/html/body/div[1]/div[3]/div/div[2]/div[3]/div/form/div[2]/ul/li[1]/div/div/button')

    def yonghu(self):
        self.click(self.users_loc)

    def mess(self):
        self.click(self.mess_loc)

    def add(self):
        self.click(self.add_loc)

    def ming(self,userName):
        self.send_keys(self.ming_loc,userName)

    def phone(self,mobile):
        self.send_keys(self.phone_loc,mobile)

    def denglu(self,password):
        self.send_keys(self.denglu_loc,password)

    def submit(self):
        self.click(self.submit_loc)

